﻿namespace 档案查询系统网络版.Helpers
{
    public class Singleton<T> where T : new()
    {
        static T? _instance;
        static object _lock = new object();

        static Singleton()
        {
        }

        public static T Instance
        {
            get
            {
                if (_instance == null)
                    lock (_lock)
                    {
                        if (_instance == null)
                        {
                            _instance = new T();
                        }
                    }

                return _instance;
            }
        }
    }
}
